﻿using SelfManagement.Database.Common;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace SelfManagement.Database.POCO
{
    [Table("User")]
    public class User: EntityBase
    {
        /// <summary>
        /// 用户名
        /// </summary>
        [StringLength(50)]
        public string UserName { get; set; }

        /// <summary>
        /// 真实姓名
        /// </summary>
        [StringLength(50)]
        public string TrueName { get; set; }
        
        /// <summary>
        /// 密码
        /// </summary>
        [StringLength(50)]
        public string Password { get; set; }
        
        /// <summary>
        /// 头像
        /// </summary>
        [StringLength(500)]
        public string UserFace { get; set; }

        /// <summary>
        /// 邮箱
        /// </summary>
        [StringLength(50)]
        public string Email { get; set; }

        /// <summary>
        /// 手机
        /// </summary>
        [StringLength(50)]
        public string Phone { get; set; }

        /// <summary>
        /// 账户状态
        /// </summary>
        [Required]
        public UserStatus Status { get; set; }

        /// <summary>
        /// 密码失败次数
        /// </summary>
        public int FailedPasswordAttemptCount { get; set; }

        /// <summary>
        /// 上次锁定日期
        /// </summary>
        public DateTime? LastLockoutDate { get; set; }

        /// <summary>
        /// 上次登录日期
        /// </summary>
        public DateTime? LastLoginDate { get; set; }

        /// <summary>
        /// 身份
        /// </summary>
        [StringLength(100)]
        public string Identity { get; set; }

        /// <summary>
        /// 个人简介
        /// </summary>
        [StringLength(500)]
        public string PersonalInfo { get; set; }

        /// <summary>
        /// 性别
        /// </summary>
        public Sex Sex { get; set; } = Sex.Secret;


    }

    public enum Sex
    {
        [Description("保密")]
        Secret,
        [Description("男")]
        Male,
        [Description("女")]
        Female,
    }

    public enum UserStatus
    {
        /// <summary>
        /// 未激活
        /// </summary>
        [Description("未激活")]
        Unactive,

        /// <summary>
        /// 激活
        /// </summary>
        [Description("已激活")]
        Normal,

        /// <summary>
        ///锁定 
        /// </summary>
        [Description("锁定")]
        Locked
    }
}
